package com.colin.aiyi.dao.ImpxUtils;

import com.colin.aiyi.app.Constant;
import com.colin.aiyi.entity.response.BaseResponse;
import com.colin.aiyi.entity.User;

import org.xutils.http.RequestParams;

/**
 * Created by hl on 2017/6/9.
 */

public class ImpSenfCode_Register extends AbsServicexUtils{


   /* 发送注册验证吗*/
    @Override
    public <V> void getObject(V v) {
        super.getObject(v);
        if (v instanceof User){
            User user= (User) v;
            RequestParams params=new RequestParams(Constant.register_sendCode);
            params.addBodyParameter("telNo",user.getTelNo());
            params.addBodyParameter("accessToken","");
            params.addBodyParameter("clientId",Constant.CLIENT_ID);
            params.addBodyParameter("clientSecret",Constant.CLIENT_SECRET);
            sendToServer(params,1);
        }
    }

    @Override
    public void onSuccess(String result) {
        super.onSuccess(result);
        if (callback==null)
        {
            sendMsgToView(BaseResponse.class,result);
        }else {
            BaseResponse loginResponse=gson.fromJson(result,BaseResponse.class);
            callback.onSuccess(loginResponse);
        }
    }
}
